﻿using System.Collections.Generic;
using Kam.Lagan.Examples.Atm.Contract.Dal;
using Kam.Lagan.Examples.Atm.Contract.Model;
using Kam.Lagan.Examples.Atm.Model;

namespace Kam.Lagan.Examples.Atm.Dal
{
    public class AccountRepository : IRepository<ICurrentAccount>
    {
        public IList<ICurrentAccount> Get()
        {
            var accounts = new List<ICurrentAccount>();

            var clients = new ClientRepository().Get();

            var ac = 0;
            var sc = 0;

            foreach (var c in clients)
            {
                var account = string.Format("0001112{0}", ac++);
                var sortCode = string.Format("40121{0}", sc++);
                var iban = string.Format("IBANUBANWEBAN");

                accounts.Add(new CurrentAccount(c, account, sortCode, iban));
            }

            return accounts;
        }
    }
}
